/* 类的继承 */
/*
 * 构造方法的调用顺序
 * 1、按继承顺序依次调用父类的不含参数的构造方法，直到到达本子类；
 * 2、依次执行本子类成员对象的构造方法；
 * 3、最后，执行本子类的构造方法。
 */
package book.ch3.example8;
class Meal{
	Meal(){
		System.out.println("Meal()");
	}
}
class Bread{
	Bread(){
		System.out.println("Bread()");
	}
}
class Cheese{
	Cheese(){
		System.out.println("Cheese()");
	}
}
class Lettuce{
	Lettuce(){
		System.out.println("Lettuce()");
	}
}
class Lunch extends Meal{
	Lunch(){
		System.out.println("Lunch()");
	}
}
class PortableLunch extends Lunch{
	PortableLunch(){
		System.out.println("PortableLunch()");
	}
}
class Sandwich extends PortableLunch{
	Bread b=new Bread();
	Cheese c=new Cheese();
	Lettuce l=new Lettuce();
	Sandwich(){
		System.out.println("Sandwich()");
	}
	public static void main(String[] args) {
		new Sandwich();
	}

}
